<template>
	<page-meta>
		<navigation-bar title="乐居" background-color="#354e44" />
	</page-meta>
	<view class="success">
		<view class="success-title">订单支付成功</view>
		<view class="success-money">支付金额:{{all}}元</view>
		<view @tap="goToUser" class="success-user">个人中心</view>
	</view>
</template>

<script>
	import {
		getPreOrderById as getPreOrderByIdApi,
		delCartItems as delCartItemsApi
	} from '../../../api/common/index.js'
	export default {
		data() {
			return {
				all:0,
			}
		},
		onLoad(config){
			this.all=config.all;
			var toDelCart=uni.getStorageSync('toDelCart');
			if(toDelCart.length!=0){
				this.delCart(toDelCart);
			}
		},
		methods: {
			//支付成功清除购物车中的商品
			delCart(toDelCart){
				
				delCartItemsApi(toDelCart)
				
			},
			//跳转到个人中心页面
			goToUser(){
				uni.switchTab({
					url:'../../user/user'
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
.success{
	overflow: auto;
	width: 100%;
	height: calc(100vh - 90rpx);
	background-color: #f1ece7;
	text-align: center;
	&-title{
		margin-top: 300rpx;
		font-size: 50rpx;
	}
	&-money{
		margin-top: 10rpx;
		font-size: 34rpx;
	}
	&-user{
		position: fixed;
		display:inline-block;
		width: 240rpx;
		height: 74rpx;
		bottom: 100rpx;
		left: 50%;
		transform: translateX(-50%);
		border: 1rpx solid gray;
		line-height: 74rpx;
		border-radius: 15rpx;
	}
}
</style>
